<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var f = function Number(arr) {
      var n = 0
      for (var i = 0; i < arr.length; i++) {
        n += arr[i]
      }
      return (1 + arr.length) * (arr.length / 2) - n
    }
    console.log(f([0, 1, 2, 3, 5, 6, 7, 8, 9, 10]))
  </script>
</body>

</html>